//
//  AccountManager.swift
//  clreader
//
//  Created by colin on 2019/3/26.
//  Copyright © 2019 colin. All rights reserved.
//

import UIKit

public class AccountManager: NSObject {

    private let kIsLogin    = "kIsLogin"
    private let kToken      = "kToken"
    
    public static let shared = AccountManager()
    
    public var isLogin:Bool {
        get {
            return UserDefaults.standard.bool(forKey: self.kIsLogin)
        }
        set {
            UserDefaults.standard.set(newValue, forKey: self.self.kIsLogin)
            UserDefaults.standard.synchronize()
        }
    }
    
    public var token:String {
        get {
            if let value = UserDefaults.standard.string(forKey: self.kToken) {
                return value
            } else {
                return ""
            }
        }
        set {
            UserDefaults.standard.set(newValue, forKey: self.kToken)
            UserDefaults.standard.synchronize()
        }
    }
    
}
